import Vue from 'vue'
import axios from 'axios'
import VueAxios from 'vue-axios'
import Router from 'vue-router'

import Login from '../pages/login'
import Register from '../pages/register'
import Index from '../pages/index'
import NewCenter from '../pages/news/newcenter'
import NewDetail from '../pages/news/newdetail'
import DownLoad from '../pages/download'
import AboutUs from '../pages/aboutus'
import Help from '../pages/help'

// 个人中心
import PersonalCenter from '../components/personalcenter'

import Center from '../pages/personalcenter/center'
import UserInfo from '../pages/personalcenter/userinfo'
import AccountManage from '../pages/personalcenter/accountmanage'

Vue.use(VueAxios, axios)
Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      redirect: '/Index'
    },
    {
      // 登录
      path: '/Login',
      component: Login
    },
    {
      // 注册
      path:'/Register',
      component: Register
    },
    {
      // 首页
      path: '/Index',
      component: Index,
      meta:{auth:true}  // 设置当前路由需要校验
    },
    {
      // 新闻
      path: '/News',
      component: NewCenter,
      meta:{auth:true}  // 设置当前路由需要校验
    }, {
      // 首页详情
      path: '/News/NewsDetail/:id',
      component: NewDetail,
      meta:{auth:true}  // 设置当前路由需要校验
    },
    {
      // 下载APP
      path: '/DownLoad',
      component: DownLoad,
      meta:{auth:true}  // 设置当前路由需要校验
    },
    {
      // 关于我们
      path: '/AboutUs',
      component: AboutUs,
      meta:{auth:true}  // 设置当前路由需要校验
    },
    {
      // 帮助中心
      path: '/Help',
      component: Help,
      meta:{auth:true}  // 设置当前路由需要校验
    },
    {
      // 个人中心
      path:'/PersonalCenter',
      component:PersonalCenter,
      redirect:'/PersonalCenter/Center',
      meta:{auth:true},  // 设置当前路由需要校验
      children:[{
        // 个人中心
        path:'Center',
        component:Center
      },{
        // 个人资料
        path:'UserInfo',
        component:UserInfo
      },{
        // 账户管理
        path:'AccountManage',
        component:AccountManage
       }]
      }
    ]  
})



